home *** CD-ROM | disk | FTP | other *** search
- ## sendkeys_basic_test
- # This script demonstrates the SendKeys features.
- # SendKeys will send a series of keystrokes to the foreground window.
- # The format of the SendKeys command uses the same structure as the Visual Basic SendKeys
- {
- -name sendkeys_basic_test
- -start -delay 0 0 0 5
- -action -onerror operation_fail
-
- # find the window - exception if not found
- -action -findWindow hwnd "Hello.*Notepad" _
-
- # set the foreground window - exception on error
- -action -setForegroundWindow hwnd
-
- # type some text
- -action -sendkeys sendkeys "Hello World!"
-
- # get file menu / SaveAs
- -action -sendkeys sendkeys "%(fa)"
-
- # type the file name
- -action -sendkeys sendkeys "c:\temp\Hello.txt"
-
- # hit the 'S'ave
- -action -sendkeys sendkeys "%s"
-
- # hit the 'Y'es
- -action -sendkeys sendkeys "%y"
-
- -action -inc 0 0 0 5
-
- }
-
- # operation failed
- {
- -name operation_fail
- -action -print SendKeys test failed with error:
- -action -print %TG.LAST_ERROR%
- -action -return break
- }
-